const polygonList = [
  [107.5, 34.5],
  [108.5, 34.5],
  [108.5, 35.5],
];
const primitives = new Cesium.PrimitiveCollection();
// 折线
const polylineInstance = new Cesium.GeometryInstance({
  geometry: new Cesium.PolylineGeometry({
    positions: polygonList
      .map((item) => Cesium.Cartesian3.fromDegrees(item[0], item[1]))
      .concat(
        Cesium.Cartesian3.fromDegrees(polygonList[0][0], polygonList[0][1])
      ),
    width: 4,
  }),
});
const polylineAppearance = new Cesium.PolylineMaterialAppearance({
  material: Cesium.Material.fromType("Color", {
    color: Cesium.Color.fromCssColorString("blue"),
  }),
});
const polylineGeometry = new Cesium.Primitive({
  geometryInstances: polylineInstance,
  appearance: polylineAppearance,
});
primitives.add(polylineGeometry);
// 面
const polygonInstance = new Cesium.GeometryInstance({
  geometry: new Cesium.PolygonGeometry({
    polygonHierarchy: new Cesium.PolygonHierarchy(
      polygonList.map((item) => Cesium.Cartesian3.fromDegrees(item[0], item[1]))
    ),
  }),
});
const polygonAppearance = new Cesium.MaterialAppearance({
  material: new Cesium.Material.fromType("Color", {
    color: Cesium.Color.fromCssColorString("blue").withAlpha(0.3),
  }),
});
const polygonGeometry = new Cesium.Primitive({
  geometryInstances: polygonInstance,
  appearance: polygonAppearance,
});
primitives.add(polygonGeometry);
viewer.scene.primitives.add(primitives);
